package cn.tedu;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Demo04 {
    public static void main(String[] args) {
        //从工具类中获取链接对象
        try (
                Connection conn=DBUtils.getConn();
            ){
            //创建执行SQL语句对象
            Statement s=conn.createStatement();
            //执行查询
            ResultSet rs = s.executeQuery("select * from emp");
            while (rs.next()){
                Object o =rs.getObject(2);
                System.out.println(o);
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
